package com.czy;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class 当月第一天和最后一天 {
    public static void main(String[] args) {
        LocalDate localDate = LocalDate.now();
        LocalDate localDate1 = localDate.withDayOfMonth(1);
        LocalDateTime localDateTime = localDate.withDayOfMonth(localDate.lengthOfMonth()).atTime(23, 59, 59);
        System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd").format(localDate1));
        System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(localDateTime));
    }
}
